<?php

$imgtime=time(); 
echo $imgtime;

$disimg='imgs/vivo20150909/vivo'.$imgtime.'.jpg';


$str = $_REQUEST['str'] ? $_REQUEST['str']:"暂\n无\n输\n入";
$str = "BBB\nAAA\nRRR\n汉子";
$str=iconv('gbk', 'utf-8', $str);
$im = imagecreate(100,120);
$white = imagecolorallocate($im,0xFF,0xFF,0xFF);
imagecolortransparent($im,$white);  //imagecolortransparent() 设置具体某种颜色为透明色，若注释
$black = imagecolorallocate($im,0x00,0x00,0x00);
imagettftext($im,15,0,0,0,$black,"font/quicksand-light-webfont.ttf",$str); //字体设置部分linux和windows的路径可能不同
//header("Content-type:image/png");
//imagepng($im);//文字生成的图片
imagepng($im,$disimg);

   
//两张图片合成方法
//$A = "imgs/2015-09-06_164601.png";
//$B = "$disimg";
//    
//$im1 = imagecreatefromstring(file_get_contents($A));
//$im2 = imagecreatefromstring(file_get_contents($B));
// 
//imagecopy($im1, $im2, 190, 290, 0, 0, imagesx($im2), imagesy($im2));
// 
////imagepng($im1);//显示出来
//imagejpeg($im1,$disimg);//保存起来



//-----bak
//$url = 'http://img.bbs.csdn.net/upload/201310/29/1383042869_349074.png';
//$im1 = imagecreatefrompng($url);
// 
////这几行必须有，否则原图的阴影层过不来
//$im2 = imagecreatetruecolor(imagesx($im1), imagesy($im1));
//$bg = imagecolorallocate($im2, 255, 255, 255);
//imagefill($im2, 0, 0, $bg);
//imagecopy($im2, $im1, 0, 0, 0, 0, imagesx($im1), imagesy($im1));
// 
//  #设置水印字体颜色
//  $color = imagecolorallocatealpha($im2,0,0,0,100);
//
//
//  #设置字体文件路径
//  $fontfile = "msyhbd.ttf";
//$fontfile = "c:/windows/fonts/FZJZJW.TTF";
//
//  #水印文字
//    $str = "我们都是好孩子";
//$str = iconv('gbk', 'utf-8', $str);
// 
//  #打水印
//  imagettftext($im2,20,20,20,100,$color,$fontfile,$str);
//  imagettftext($im2,20,20,30,200,$color,$fontfile,$str);
//  imagettftext($im2,20,20,40,300,$color,$fontfile,$str);
// 
//imagepng($im2);

	
?>